import request from "@/utils/request";

const baseURL = "/official-website/unit/feed";

export type FeedDetail = {
  id: string;
  feedShowType: number; //显示类型;1：对齐，2：不规则
  feedType: number; //信息流类型;1：图文，2：视频
  imageUrls: string[]; //图片地址URL
  videoUrl: string; //视频地址URL
  videoCoverUrl: string; //视频封面URL
  feedContent: string; //内容
  feedTitle: string; //标题
  sortNo: number; //排序
};

export interface FeedGet extends PageParams {
  feedShowType?: number;
  feedType?: number;
}

// 根据信息流id获取信息流详情
export const getFeedById = (id: string) =>
  request<Res<FeedDetail>>({
    url: `${baseURL}/get-feed-by-id`,
    method: "GET",
    params: { id },
  });

// 分页查询信息流
export const getFeed = (data: FeedGet) =>
  request<Res<{ list: FeedDetail[] }>>({
    url: `${baseURL}/page`,
    method: "POST",
    data,
  });
